@extends('extend.admin')
@section('title','用户添加')
@section('content')
<section id="main-content">
    <div class="row">
        <div class="col-md-12">
            <!--breadcrumbs start -->
            <ul class="breadcrumb">
                <li><a href="/admin">首页</a>
                </li>
                <li>商品管理</li>
                <li class="active">商品添加</li>
            </ul>
            <!--breadcrumbs end -->
            <h1 class="h1">商品添加</h1>
        </div>
    </div>
    <div class="row">
        <div class="col-md-12">
        <form action="/goods/insert" method="post" enctype="multipart/form-data">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title">编辑商品</h3>
                </div>
                @if(count($errors)>0)
                    <div class="alert alert-danger alert-dismissable">
                    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                        @foreach ($errors->all() as $error)
                        <strong>哇哦...出错了!!!</strong>:{{$error}}<br/>
                        @endforeach
                    </div>
                @endif
                <div class="panel-body">
                    <div class="col-md-12">
                        <div class="col-md-12">
                            <div class="form-group">
                                <label for="exampleInputEmail2">商品标题</label>
                                <input type="text" name="title" class="form-control" id="exampleInputEmail2" placeholder="请输入商品的标题...">
                            </div>
                        </div>
                    </div>
                    <div class="col-md-12">
                        <div class="col-md-12">
                            <div class="form-group">
                                <label for="exampleInputEmail2">商品价格</label>
                                <input type="text" name="price" class="form-control" id="exampleInputEmail2" placeholder="请输入商品的价格...">
                            </div>
                        </div>
                    </div>
                    <div class="col-md-12">
                        <div class="col-md-12">
                            <div class="form-group">
                                <label for="exampleInputEmail2">商品库存</label>
                                <input type="text" name="store" class="form-control" id="exampleInputEmail2" placeholder="请输入商品的价格...">
                            </div>
                        </div>
                    </div>
                    <div class="col-md-12">
                        <div class="col-md-12">
                        <label for="exampleInputEmail2">商品分类</label>
                            <select class="form-control" name="type_id">
                                <option value="0">顶级分类</option>
                                @foreach($types as $k=>$v)
                                    {{$num=substr_count($v->pd,',') }}
                                    {{$v->name=str_repeat('----|',$num).$v->name}}
                                    <option value="{{$v->id}}">{{$v->name}}</option>
                                @endforeach
                            </select>
                        </div>
                    </div>
                    <div class="col-md-12">
                        <div class="col-md-12" style="padding:20px 12px">
                        <label for="exampleInputEmail2">商品图片</label>
                            <input type="file" multiple name="goods_img[]" class="form-control" id="exampleInputEmail2">
                        </div>
                    </div>
                    <div class="col-md-12">
                        <div class="col-md-12" style="padding:20px 12px">
                        <label for="exampleInputEmail2">发布状态</label>
                            <div>
                                立即发布&nbsp;:&nbsp;<input type="radio" name="status" value="1" checked id="exampleInputEmail2">&nbsp;&nbsp;&nbsp;&nbsp;
                                放入仓库&nbsp;:&nbsp;<input type="radio" name="status" value="0" id="exampleInputEmail2">
                            </div>
                        </div>
                    </div>
                    <div class="col-md-12">
                        <div class="col-md-12" style="padding:20px 12px">
                        <label for="exampleInputEmail2">商品尺码</label>
                            <div>
                                L&nbsp;:&nbsp;<input type="checkbox" name ="size[]" value="L" id="exampleInputEmail2">
                                S&nbsp;:&nbsp;<input type="checkbox" name ="size[]" value="S" id="exampleInputEmail2">
                                M&nbsp;:&nbsp;<input type="checkbox" name ="size[]" value="M" id="exampleInputEmail2">
                                XL&nbsp;:&nbsp;<input type="checkbox" name ="size[]" value="XL" id="exampleInputEmail2">
                                XXL&nbsp;:&nbsp;<input type="checkbox" name ="size[]" value="XXL" id="exampleInputEmail2">
                                XXXL&nbsp;:&nbsp;<input type="checkbox" name ="size[]" value="XXXL" id="exampleInputEmail2">
                            </div>
                        </div>
                    </div>
                    <div class="col-md-12">
                        <div class="col-md-12" style="padding:20px 12px">
                        <label for="exampleInputEmail2">商品颜色</label>
                            <div>
                                富士红&nbsp;:&nbsp;<input type="checkbox" name="color[]" value="富士红" id="exampleInputEmail2">
                                天空蓝&nbsp;:&nbsp;<input type="checkbox" name="color[]" value="天空蓝" id="exampleInputEmail2">
                                简约灰&nbsp;:&nbsp;<input type="checkbox" name="color[]" value="简约灰" id="exampleInputEmail2">
                                典雅白&nbsp;:&nbsp;<input type="checkbox" name="color[]" value="典雅白" id="exampleInputEmail2">
                                尊贵黑&nbsp;:&nbsp;<input type="checkbox" name="color[]" value="尊贵黑" id="exampleInputEmail2">
                                宝石绿&nbsp;:&nbsp;<input type="checkbox" name="color[]" value="宝石绿" id="exampleInputEmail2">
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title">商品详情</h3>
                </div>
                <div class="panel-body">
                    <div class="form-group">
                        <!-- 加载编辑器的容器 -->
                        <script id="editor" name="detail" type="text/plain" style="width:100%;height:300px;"></script>
                        <!-- 配置文件 -->
                        <script type="text/javascript" src="/admins/ueditor/ueditor.config.js"></script>
                        <!-- 编辑器源码文件 -->
                        <script type="text/javascript" src="/admins/ueditor/ueditor.all.js"></script>
                        <!-- 实例化编辑器 -->
                        <script type="text/javascript">
                            var ue = UE.getEditor('editor');
                        </script>
                    </div>
                    <button type="submit" class="btn btn-success"><i class="fa fa-check"></i> 提交</button>
                </div>
               {{csrf_field()}}
            </div>
        </form>
        </div>
    </div>
</section> 
@endsection